package io.renren.modules.quickService.constants;

import java.util.HashMap;
import java.util.Map;

public enum AttachmentType {
    ORDER_NEW_ORDER("ORDER_NEW_ORDER", "新订单附件"),
    ORDER_TAKE("ORDER_TAKE","接单附件"),
    ORDER_SCHEDULING("ORDER_SCHEDULING","安排附件"),
    ORDER_VISITING("ORDER_VISITING","看现场附件"),
    ORDER_AGREEMENT("ORDER_AGREEMENT","签协议附件"),
    ORDER_MIDDLE_CONFIRM("ORDER_MIDDLE_CONFIRM","中期验收附件"),
    ORDER_COMPLETED_CONSTRUCTION("ORDER_COMPLETED_CONSTRUCTION", "施工完成附件"),
    ORDER_ACCOUNT_CHECKING("ORDER_ACCOUNT_CHECKING","对账附件"),
    ORDER_AFTER_SALES("ORDER_AFTER_SALES","售后附件"),
    ORDER_FINISHED("ORDER_FINISHED", "完成附件"),
    APP_USER("APP_USER","APP用户");

    private final String key;
    private final String value;

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    AttachmentType(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getValueByKey(String key) {
        AttachmentType[] enums = AttachmentType.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getKey().equals(key)) {
                return enums[i].getValue();
            }
        }
        return "";
    }


    /**
     * 转换为MAP集合	 * 	 * @returnMap<String, String>
     */
    public static Map<String, String> toMap() {
        Map<String, String> map = new HashMap<String, String>();
        AttachmentType[] enums = AttachmentType.values();
        for (int i = 0; i < enums.length; i++) {
            map.put(enums[i].getKey().toString(), enums[i].getValue());
        }
        return map;
    }
}
